package io.renren.modules.testrestful.controller;

import io.renren.modules.testrestful.entity.User;
import io.renren.modules.testrestful.service.UsersService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController

@RequestMapping(value = "/users")
public class UserController {

     @Autowired
     UsersService usersService;

     @GetMapping("/")
     public List<User> findAll(){
         return usersService.getUsersList();
    }
    @PostMapping("/")

    public int addUser(@RequestBody User user){

     System.out.println("hello");

     return usersService.postUsers(user);

     }

}